package de.gwtprime.server.util;

import com.google.appengine.api.utils.SystemProperty;

import de.gwtprime.shared.util.AppUtilsShared;

/**
 * Helper methods for the server side
 */
public class AppUtils {

	public enum SessionFields{
		
		User("user"),
		Test("test");
		
		private String name;
		
		SessionFields(String name){
			this.name = name;
		}
		
		@Override
		public String toString() {
			return name;
		}
		
	}
	
	/**
	 * Check if currently running on app engine
	 * @return
	 */
	public static boolean isAppEngine(){
		return SystemProperty.environment.value() ==
			    SystemProperty.Environment.Value.Production;
	}
	
	public static String getHostUrl(){
		return isAppEngine() ? AppUtilsShared.DOMAIN_PROD : AppUtilsShared.DOMAIN_LOCAL;
	}
}
